package sv.gob.mh.dgii.security.mantto.comparator;

import java.util.Comparator;
import sv.gob.mh.dgii.model.AsOpcion;
import sv.gob.mh.dgii.model.AsRol;

public class AsRolComparator implements Comparator<AsRol> {

    public AsRolComparator() {
    }

    @Override
    public int compare(AsRol o1, AsRol o2) {
        int ret = 0;
        if (o1 == null && o2 == null) {
            ret = 0;
        } else if (o1 != null && o2 == null) {
            ret = 1;
        } else if (o1 == null && o2 != null) {
            ret = -1;
        } else if (o1 != null && o2 != null) {
            if (o1.getCrol() == null && o1.getCrol() == null) {
                ret = 0;
            } else if (o1.getCrol() != null && o1.getCrol() == null) {
                ret = 1;
            } else if (o1.getCrol() == null && o1.getCrol() != null) {
                ret = -1;
            } else if (o1.getCrol() != null && o1.getCrol() != null) {
                ret = o1.getCrol().compareTo(o2.getCrol());
            } else {
                ret = 0;
            }
        }
        return ret;
    }
}
